Introduction

Rationale

Public safety is vital to public health and happiness. Our goal was to build R shiny app to analyze various aspects of crimes in Boston, including:

  • Map displaying individual crimes by day

  • Heatmap displaying dangerous locations overall

  • Time series displaying trend of different crimes over time

  • Schools map displaying relationship between school locations and crime rate

  • Income map displayong relationship between income and crime rate by location

Data

The data is from Boston Police Department hosted at data.boston.gov (https://data.boston.gov/dataset/crime-incident-reports-august-2015-to-date-source-new-system, https://data.boston.gov/dataset/crime-incident-reports-july-2012-august-2015-source-legacy-system)

In total, there are 608,471 crimes recorded in the dataset. For each crime, the date, time, location, and crime description is provided.

Outline

Here are the main areas this report addresses:

  • Most frequent crime types

  • Most frequent time periods of crime

  • Most frequent locations of crime

  • Changes in crime over time

  • Relationship between crime & schools

  • Relationship between crime & income

This data contains crime data in Boston from 2015-06-15 to 2018-11-17, a total of 340415 incidents with 17 variables. It comes from the Boston Police Department (data.boston.gov).

Crime type

Most frequent crime type in Boston from 2012-2018

The most frequent crime type is Motor vehicle accident followed by larceny and medical assistant.
### Most frequent crime by UCR_PART in Boston

The Uniform Crime Reports (UCR) compiles official data on crime in the United States, published by the Federal Bureau of Investigation (FBI). In Boston, the most frequent two crime types are Part I and Part II. In Part I, the UCR indexes reported incidents of index crimes which are broken into two categories: violent and property crimes.In Part II, the following categories are tracked: simple assault, curfew offenses and loitering, embezzlement, forgery and counterfeiting, disorderly conduct, driving under the influence, drug offenses, fraud, gambling, liquor offenses, offenses against the family, prostitution, public drunkenness, runaways, sex offenses, stolen property, vandalism, vagrancy, and weapons offenses.

Trend of crime types in Boston from 2012-2018

Time

Hour

Below shows a distribution of crime by the hour of the day: there seems to be less crime during early morning (around 5 am), which makes sense since probably most people are asleep. As it gets to morning the crime rate goes up, and the amount of crime peaks around 4-7pm, before gradually dropping as night comes.

  • y-axis shows average number of crime per day during that hour, and errorbar shows standard error (all errorbars in subsequent graphs show standard error)

There are two other peaks at 12-1am and 12-1pm in the graph above, but it is likely due to data entry habits:

Above shows distribution of crime by the minute. There are two large peaks at 0 (= 12:00am) and at 720 (= 12:00pm), so possibly the police logged these two times in the database when the exact time is unclear

Day of the Week

Below shows a boxplot that compares the number of crime per day between different days of the week. From the graph it seems like actually Sunday has the lowest number of crimes, which might be a little surprising since it is in the weekend. Friday has the highest number of crimes (although the difference is small)


The graph below shows more detailed distribution of crime across day of week & hour. The color shows the average number of crime at the specific hour and day of week (darker color is higher crime)

As we have observed before, crime is lower during early morning, but the exact period of time with lowest number of crime shifts according to the day of the week: on weekdays crime is lowest around 1-5am, while on weekends it shifts later and becomes lowest around 3-6am. You might expect since people stay up to later on the weekends.

Day of the Month

Below shows the distribution of crime according to day of the month

1st, 15th, 31st have slightly larger number of crime, which could be due to data entry habits

Month

Graph below shows the distribution of crime over different months of the year: crime seems to increase at the beginning of the year, peak at around July, and then decrease again (although the difference is not very large).

This might be expected since Boston is up north and can be pretty cold, so people might stay inside more during the winter, leading to reduced crime.


The graph below breaks it down by day of the year. Again you can see the crime count increasing in beginning of the year, peaking around mid-year, and then dropping again.

(The blue lines in the back show standard error)

  • There is a huge dip at around 359~360th day of the year, which corresponds to Christmas every year, so it seems like there is reduced crime on Christmas. Criminals apparently enjoy holidays too

Year

Below shows the distribution of crime (average number of crime per day) across different years: there appears to be an increase between 2014 and 2015, but this could be due to data issues (our data comes from two sets, one 2012~2015, one 2015~2018, so it is possible that the police now records or reports more crimes in the new crime entry system they started using in 2015)

Time series analysis

Total Crime Trend

Shooting

There’s a significant increase in shooting cases in Boston from the end of 2015 to 2016. This change might be accounted by changing the new crime recording system in Boston so that police officers can better tracing different crimes in Boston. The highest shooting crimes in one day occurred on 2017.12.19, on that day we found several new reported about shooting in Boston and several teens were killed.

Drug Violation

In Boston, the drug violation rate is fairly consistent throughout 2012 to 2018. One interesting thing we noticed is that drug related crime is slightly increased during summer time of each year and it reaches its peak in 2015 summer time. This might because of the fact that it is warmer in summer thus traders are more willing to deal drugs.

Motor Vehicle Accident

The graph below shows the motor vehicle accident throughout 2012 to 2018 in Boston. There’s a slightly decrease in the accident rate trend after the end of 2015. The highest peak of motor vehicle accident happens by the end of Jan of 2015 and Feb in 2015. This is mainly a result from historically severe snow storm in 2015. Thus it explains why there’s sudden increase on motor vehicle accident during this time.

Crime Trend By UCR Part

Part One

Part Two

Part Three

Location

Police District

Below shows the distribution of crime by police district: Roxbury seems to be the most dangerous, and Charlestown the least dangerous.

Here is a map of the Boston police districts shaded by average number of crime:

For more fine-grained graphs or exploration, check out our RShiny App!

0.34%, or 2080 of the cases had shooting involved. Below is a distribution of them across the districts:

  • The ordering is mostly similar: again Roxbury tops the chart, while Charlestown had the lowest, but this time the difference appears more extreme.

  • Downtown Boston ranks quite high considering all crimes, but ranks lower when only shooting is considered. Jamaica Plains ranks relatively low considering all crimes, but ranks higher when only shooting is considered.

Street

Word Cloud

Here’s a wordcloud and bar graph for the most dangerous street, ranking by the average amount of crimes reported on this street. Based on the bar graph, the most dangerous street is Washington st, however due to the limitation of the word cloud, we were not able to show Washington street on the graph. The wordcloud and bar graph give similar result on which street has most crimes, the top three are: Washington ST, Boyston St and Blue Hill Ave.

School & Crime

Data

We downloaded locations of public schools (K-12), non-public schools (K-12), and colleges/universities in Boston from data.boston.gov (https://data.boston.gov/dataset/public-schools, https://data.boston.gov/dataset/non-public-schools, https://data.boston.gov/dataset/colleges-and-universities)

In total, there are 131 public schools, 82 non-public schools, and 60 colleges/universities in the dataset.

Calculations

We calculated the number of crime within a 2km * 2km box of each school in the dataset using coordinates (so approximately in an area with radius 1km).

Analysis

General School Type

The boxplot below shows the crime count for different public schools, non-public schools, and colleges/universities:

As you might expect, non-public schools are the safest, public schools slightly more dangerous (more crimes), and colleges the least safe.

City Area

Below are average counts of crime (per school) for public/non-public schools/colleges, broken down by city area:

Roxbury, Boston seem to be the most dangerous, West Roxbury the safest. You can check which school areas are the safest from these graphs.

Grade

Generally, the younger the students, the more safe it is (from Elementary School to Middle School to High School), which is expected probably, but still good to know. The error is large though, so the difference might be very small.

Income & Crime

Data

The income data comes from the 2017 government census (https://www.census.gov/geo/maps-data/data/cbf/cbf_tracts.html, https://datausa.io/profile/geo/boston-ma/). There are in total 170 census tracts (or areas).

## OGR data source with driver: ESRI Shapefile 
## Source: "/Users/Christina/Downloads/cb_2017_25_tract_500k/cb_2017_25_tract_500k.shp", layer: "cb_2017_25_tract_500k"
## with 1475 features
## It has 9 fields
## Integer64 fields read as doubles:  ALAND AWATER

Map

The map below shows the median household income by census tract (darker color represents higher income):

From the income map, the highest income region is in the outer-west part and also in downtown region. The mid-southern part has the lowest income.

Compare this with the map of crime count:

Looking at the crime map, the most crime-concentrated areas include the downtown (dark-red) area and some scattered in the mid-southern part of Boston. So it seems like for some regions (mid-southern parts), indeed there is lower income and higher crime count. However, this is not true for other regions (for example, downtown). This makes sense since Boston is a large city, so even in high-income areas there could be large concentration of people, leading to higher crime rate

Correlation between Crime and Income

The scatterplot above shows the median income and crime count of different census tracts. There appears to be no strong correlation between crime and income (indeed, the r-squared value is less than 0.03)